// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Chronicle API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_chronicle_v1::client::DataAccessControlService;
/// let client = DataAccessControlService::builder().build().await?;
/// // use `client` to make requests to the Chronicle API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// DataAccessControlService exposes resources and endpoints related to data
/// access control.
///
/// # Configuration
///
/// To configure `DataAccessControlService` use the `with_*` methods in the type returned
/// by [builder()][DataAccessControlService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://chronicle.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::data_access_control_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::data_access_control_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `DataAccessControlService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `DataAccessControlService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct DataAccessControlService {
    inner: std::sync::Arc<dyn super::stub::dynamic::DataAccessControlService>,
}

impl DataAccessControlService {
    /// Returns a builder for [DataAccessControlService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
    /// let client = DataAccessControlService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::data_access_control_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::data_access_control_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::DataAccessControlService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::DataAccessControlService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DataAccessControlService> {
        super::transport::DataAccessControlService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DataAccessControlService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::DataAccessControlService::new)
    }

    /// Creates a data access label.
    /// Data access labels are applied to incoming event data and selected in data
    /// access scopes (another resource), and only users with scopes containing the
    /// label can see data with that label. Currently, the data access label
    /// resource only includes custom labels, which are labels that correspond
    /// to UDM queries over event data.
    pub fn create_data_access_label(
        &self,
    ) -> super::builder::data_access_control_service::CreateDataAccessLabel {
        super::builder::data_access_control_service::CreateDataAccessLabel::new(self.inner.clone())
    }

    /// Gets a data access label.
    pub fn get_data_access_label(
        &self,
    ) -> super::builder::data_access_control_service::GetDataAccessLabel {
        super::builder::data_access_control_service::GetDataAccessLabel::new(self.inner.clone())
    }

    /// Lists all data access labels for the customer.
    pub fn list_data_access_labels(
        &self,
    ) -> super::builder::data_access_control_service::ListDataAccessLabels {
        super::builder::data_access_control_service::ListDataAccessLabels::new(self.inner.clone())
    }

    /// Updates a data access label.
    pub fn update_data_access_label(
        &self,
    ) -> super::builder::data_access_control_service::UpdateDataAccessLabel {
        super::builder::data_access_control_service::UpdateDataAccessLabel::new(self.inner.clone())
    }

    /// Deletes a data access label. When a label is deleted, new
    /// data that enters in the system will not receive the label, but the label
    /// will not be removed from old data that still refers to it.
    pub fn delete_data_access_label(
        &self,
    ) -> super::builder::data_access_control_service::DeleteDataAccessLabel {
        super::builder::data_access_control_service::DeleteDataAccessLabel::new(self.inner.clone())
    }

    /// Creates a data access scope.
    /// Data access scope is a combination of allowed and denied labels attached
    /// to a permission group. If a scope has allowed labels A and B and denied
    /// labels C and D, then the group of people attached to the scope
    /// will have permissions to see all events labeled with A or B (or both) and
    /// not labeled with either C or D.
    pub fn create_data_access_scope(
        &self,
    ) -> super::builder::data_access_control_service::CreateDataAccessScope {
        super::builder::data_access_control_service::CreateDataAccessScope::new(self.inner.clone())
    }

    /// Retrieves an existing data access scope.
    pub fn get_data_access_scope(
        &self,
    ) -> super::builder::data_access_control_service::GetDataAccessScope {
        super::builder::data_access_control_service::GetDataAccessScope::new(self.inner.clone())
    }

    /// Lists all existing data access scopes for the customer.
    pub fn list_data_access_scopes(
        &self,
    ) -> super::builder::data_access_control_service::ListDataAccessScopes {
        super::builder::data_access_control_service::ListDataAccessScopes::new(self.inner.clone())
    }

    /// Updates a data access scope.
    pub fn update_data_access_scope(
        &self,
    ) -> super::builder::data_access_control_service::UpdateDataAccessScope {
        super::builder::data_access_control_service::UpdateDataAccessScope::new(self.inner.clone())
    }

    /// Deletes a data access scope.
    pub fn delete_data_access_scope(
        &self,
    ) -> super::builder::data_access_control_service::DeleteDataAccessScope {
        super::builder::data_access_control_service::DeleteDataAccessScope::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::data_access_control_service::ListOperations {
        super::builder::data_access_control_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::data_access_control_service::GetOperation {
        super::builder::data_access_control_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::data_access_control_service::DeleteOperation {
        super::builder::data_access_control_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::data_access_control_service::CancelOperation {
        super::builder::data_access_control_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Chronicle API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_chronicle_v1::client::EntityService;
/// let client = EntityService::builder().build().await?;
/// // use `client` to make requests to the Chronicle API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// EntityService contains apis for finding entities.
///
/// # Configuration
///
/// To configure `EntityService` use the `with_*` methods in the type returned
/// by [builder()][EntityService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://chronicle.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::entity_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::entity_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `EntityService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `EntityService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct EntityService {
    inner: std::sync::Arc<dyn super::stub::dynamic::EntityService>,
}

impl EntityService {
    /// Returns a builder for [EntityService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_chronicle_v1::client::EntityService;
    /// let client = EntityService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::entity_service::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::entity_service::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::EntityService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EntityService>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EntityService> {
        super::transport::EntityService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EntityService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::EntityService::new)
    }

    /// Gets watchlist details for the given watchlist ID.
    pub fn get_watchlist(&self) -> super::builder::entity_service::GetWatchlist {
        super::builder::entity_service::GetWatchlist::new(self.inner.clone())
    }

    /// Lists all watchlists for the given instance.
    pub fn list_watchlists(&self) -> super::builder::entity_service::ListWatchlists {
        super::builder::entity_service::ListWatchlists::new(self.inner.clone())
    }

    /// Creates a watchlist for the given instance.
    /// Note that there can be at most 200 watchlists per instance.
    pub fn create_watchlist(&self) -> super::builder::entity_service::CreateWatchlist {
        super::builder::entity_service::CreateWatchlist::new(self.inner.clone())
    }

    /// Updates the watchlist for the given instance.
    pub fn update_watchlist(&self) -> super::builder::entity_service::UpdateWatchlist {
        super::builder::entity_service::UpdateWatchlist::new(self.inner.clone())
    }

    /// Deletes the watchlist for the given instance.
    pub fn delete_watchlist(&self) -> super::builder::entity_service::DeleteWatchlist {
        super::builder::entity_service::DeleteWatchlist::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::entity_service::ListOperations {
        super::builder::entity_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::entity_service::GetOperation {
        super::builder::entity_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::entity_service::DeleteOperation {
        super::builder::entity_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::entity_service::CancelOperation {
        super::builder::entity_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Chronicle API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_chronicle_v1::client::InstanceService;
/// let client = InstanceService::builder().build().await?;
/// // use `client` to make requests to the Chronicle API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// InstanceService provides the entry interface for the Chronicle API.
///
/// # Configuration
///
/// To configure `InstanceService` use the `with_*` methods in the type returned
/// by [builder()][InstanceService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://chronicle.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::instance_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::instance_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `InstanceService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `InstanceService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct InstanceService {
    inner: std::sync::Arc<dyn super::stub::dynamic::InstanceService>,
}

impl InstanceService {
    /// Returns a builder for [InstanceService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_chronicle_v1::client::InstanceService;
    /// let client = InstanceService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::instance_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::instance_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::InstanceService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::InstanceService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::InstanceService> {
        super::transport::InstanceService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::InstanceService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::InstanceService::new)
    }

    /// Gets a Instance.
    pub fn get_instance(&self) -> super::builder::instance_service::GetInstance {
        super::builder::instance_service::GetInstance::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::instance_service::ListOperations {
        super::builder::instance_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::instance_service::GetOperation {
        super::builder::instance_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::instance_service::DeleteOperation {
        super::builder::instance_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::instance_service::CancelOperation {
        super::builder::instance_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Chronicle API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_chronicle_v1::client::ReferenceListService;
/// let client = ReferenceListService::builder().build().await?;
/// // use `client` to make requests to the Chronicle API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// ReferenceListService provides an interface for managing reference lists.
///
/// # Configuration
///
/// To configure `ReferenceListService` use the `with_*` methods in the type returned
/// by [builder()][ReferenceListService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://chronicle.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::reference_list_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::reference_list_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `ReferenceListService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `ReferenceListService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct ReferenceListService {
    inner: std::sync::Arc<dyn super::stub::dynamic::ReferenceListService>,
}

impl ReferenceListService {
    /// Returns a builder for [ReferenceListService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
    /// let client = ReferenceListService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::reference_list_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::reference_list_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::ReferenceListService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ReferenceListService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ReferenceListService> {
        super::transport::ReferenceListService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ReferenceListService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::ReferenceListService::new)
    }

    /// Gets a single reference list.
    pub fn get_reference_list(&self) -> super::builder::reference_list_service::GetReferenceList {
        super::builder::reference_list_service::GetReferenceList::new(self.inner.clone())
    }

    /// Lists a collection of reference lists.
    pub fn list_reference_lists(
        &self,
    ) -> super::builder::reference_list_service::ListReferenceLists {
        super::builder::reference_list_service::ListReferenceLists::new(self.inner.clone())
    }

    /// Creates a new reference list.
    pub fn create_reference_list(
        &self,
    ) -> super::builder::reference_list_service::CreateReferenceList {
        super::builder::reference_list_service::CreateReferenceList::new(self.inner.clone())
    }

    /// Updates an existing reference list.
    pub fn update_reference_list(
        &self,
    ) -> super::builder::reference_list_service::UpdateReferenceList {
        super::builder::reference_list_service::UpdateReferenceList::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::reference_list_service::ListOperations {
        super::builder::reference_list_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::reference_list_service::GetOperation {
        super::builder::reference_list_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::reference_list_service::DeleteOperation {
        super::builder::reference_list_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::reference_list_service::CancelOperation {
        super::builder::reference_list_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Chronicle API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_chronicle_v1::client::RuleService;
/// let client = RuleService::builder().build().await?;
/// // use `client` to make requests to the Chronicle API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// RuleService provides interface for user-created rules.
///
/// # Configuration
///
/// To configure `RuleService` use the `with_*` methods in the type returned
/// by [builder()][RuleService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://chronicle.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::rule_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::rule_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `RuleService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `RuleService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct RuleService {
    inner: std::sync::Arc<dyn super::stub::dynamic::RuleService>,
}

impl RuleService {
    /// Returns a builder for [RuleService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_chronicle_v1::client::RuleService;
    /// let client = RuleService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::rule_service::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::rule_service::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::RuleService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RuleService>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::RuleService> {
        super::transport::RuleService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::RuleService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::RuleService::new)
    }

    /// Creates a new Rule.
    pub fn create_rule(&self) -> super::builder::rule_service::CreateRule {
        super::builder::rule_service::CreateRule::new(self.inner.clone())
    }

    /// Gets a Rule.
    pub fn get_rule(&self) -> super::builder::rule_service::GetRule {
        super::builder::rule_service::GetRule::new(self.inner.clone())
    }

    /// Lists Rules.
    pub fn list_rules(&self) -> super::builder::rule_service::ListRules {
        super::builder::rule_service::ListRules::new(self.inner.clone())
    }

    /// Updates a Rule.
    pub fn update_rule(&self) -> super::builder::rule_service::UpdateRule {
        super::builder::rule_service::UpdateRule::new(self.inner.clone())
    }

    /// Deletes a Rule.
    pub fn delete_rule(&self) -> super::builder::rule_service::DeleteRule {
        super::builder::rule_service::DeleteRule::new(self.inner.clone())
    }

    /// Lists all revisions of the rule.
    pub fn list_rule_revisions(&self) -> super::builder::rule_service::ListRuleRevisions {
        super::builder::rule_service::ListRuleRevisions::new(self.inner.clone())
    }

    /// Create a Retrohunt.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_retrohunt(&self) -> super::builder::rule_service::CreateRetrohunt {
        super::builder::rule_service::CreateRetrohunt::new(self.inner.clone())
    }

    /// Get a Retrohunt.
    pub fn get_retrohunt(&self) -> super::builder::rule_service::GetRetrohunt {
        super::builder::rule_service::GetRetrohunt::new(self.inner.clone())
    }

    /// List Retrohunts.
    pub fn list_retrohunts(&self) -> super::builder::rule_service::ListRetrohunts {
        super::builder::rule_service::ListRetrohunts::new(self.inner.clone())
    }

    /// Gets a RuleDeployment.
    pub fn get_rule_deployment(&self) -> super::builder::rule_service::GetRuleDeployment {
        super::builder::rule_service::GetRuleDeployment::new(self.inner.clone())
    }

    /// Lists RuleDeployments across all Rules.
    pub fn list_rule_deployments(&self) -> super::builder::rule_service::ListRuleDeployments {
        super::builder::rule_service::ListRuleDeployments::new(self.inner.clone())
    }

    /// Updates a RuleDeployment.
    /// Failures are not necessarily atomic. If there is a request to update
    /// multiple fields, and any update to a single field fails, an error will be
    /// returned, but other fields may remain successfully updated.
    pub fn update_rule_deployment(&self) -> super::builder::rule_service::UpdateRuleDeployment {
        super::builder::rule_service::UpdateRuleDeployment::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::rule_service::ListOperations {
        super::builder::rule_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::rule_service::GetOperation {
        super::builder::rule_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::rule_service::DeleteOperation {
        super::builder::rule_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::rule_service::CancelOperation {
        super::builder::rule_service::CancelOperation::new(self.inner.clone())
    }
}
